
<style>
.affix{top:10px;}
.head-style-list li,.editor-template-list li{cursor: pointer;}
.previewBroad .title , .previewBroad .submsg-title {
    padding: 0px 0px;
}
.submsg-title p{line-height:1.5em;}
.previewBroad {    padding: 5px 10px;}
.previewBroad p{border-bottom:1px solid #e7e7eb;}
.previewBroad .appmsg{border:0 none;}
</style>

		<div class="ui-portlet">
			{{template wxes/_user_wxes}}
			<ol class="breadcrumb">
			  <li><a href="/users/index"><i class="fa fa-home"></i>&nbsp;&nbsp;个人中心</a></li>
			  <li><a href="/wx_timing_broads/mine">定时群发</a></li>
			  <li class="active">新增|编辑定时群发</li>
			</ol> 
		</div>          
       <hr>

{{$this->Form->create('WxTimingBroad',array('class'=>'form-horizontal','role'=>'form'))}}
		
	<div class="tab-content">
		
			
		<div role="tabpanel" class="tab-pane active" id="chi-info">
			
			<div class="form-group">
				<label class="col-sm-2 control-label" for="WxTimingBroadName">消息类型</label>
				<div class="col-sm-9 controls">
					{{$this->Form->hidden('id')}}
					{{$this->Form->input('msg_type',array('class'=>'form-control','options'=>array('news'=>'图文','voice'=>'语音','image'=>'图片','video'=>'视频'),'div'=>false,'label'=>false))}}
				</div>
			</div>
			<div class="form-group" id="divWxMenuSlug">
				<label class="col-sm-2 control-label" for="WxMenuKey">群发素材</label>
				<div class="col-sm-9 controls">
					{{$this->Form->input('media_id',array('class'=>'form-control','required'=>'required','type'=>'text','readonly'=>'readonly','div'=>false,'label'=>false))}}
					<p><small>点击下方按钮，从微信素材中选择要群发的内容。</small></p>
					<p><a href="javascript:void(0)" class="btn btn-primary btn-sm" onclick="publishController.open_dialog('/wx_msgs/wechat?type=select&inajax=1&m='+$('#WxTimingBroadMsgType').val(),{'selector':'#wechat-msg-mine-list',width:900,title:'选择微信素材',callback:function($dialog){$dialog.find('.choose-media').click(function(){ $('#WxTimingBroadMediaId').val( $(this).data('mid') );prew_msg($(this).data('mid'));$dialog.modal('hide');}) } });" >选择素材</a></p>
				</div>
			</div>
			
			<!-- <div class="form-group">
				<label class="col-sm-2 control-label" for="WxTimingBroadSendIgnoreReprint">是否原创</label>
				<div class="col-sm-9 controls">
					{{$this->Form->input('original',array('class'=>'form-control','default'=>0,'options'=>array('1'=>'是','0'=>'否'),'div'=>false,'label'=>false))}}
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label" for="WxTimingBroadSendIgnoreReprint">开启留言</label>
				<div class="col-sm-9 controls">
					{{$this->Form->input('allow_comment',array('class'=>'form-control','default'=>0,'options'=>array('1'=>'是','0'=>'否'),'div'=>false,'label'=>false))}}
				</div>
			</div>
			
			<div class="alert alert-warning">提示：未开通原创与留言功能的公众号，请勿选择是。群发多图文时，此处选择视为全部标记原创或开启留言。</div>
			-->
			
			<div class="form-group">
				<label class="col-sm-2 control-label" for="WxTimingBroadSendIgnoreReprint">转载选项</label>
				<div class="col-sm-9 controls">
					{{$this->Form->input('send_ignore_reprint',array('class'=>'form-control','default'=>1,'options'=>array('1'=>'文章被判定为转载时，继续进行群发操作','0'=>'文章被判定为转载时，停止群发操作'),'div'=>false,'label'=>false))}}
					<p><small>文章识别非原创时，会标记原文来源公众号。确认是否继续群发。</small></p>
				</div>
			</div>
			 
						
			<div class="form-group">
				<label class="col-sm-2 control-label" for="WxStorefrontPriority">群发时间</label>
				<div class="col-sm-9 controls form-inline">
					{{$this->Form->input('sendtime',array('class'=>'form-control','type'=>'datetime','dateFormat'=>'YMD','timeFormat'=>24,
					'monthNames'=> array(
						1=>'1月',2=>'2月',3=>'3月',4=>'4月',5=>'5月',6=>'6月',
						7=>'7月',8=>'8月',9=>'9月',10=>'10月',11=>'11月',12=>'12月',
					),
					'div'=>false,'label'=>false,))}}
					{{if $current_action=='add'}}
					<p><small>若已群发过，默认时间的时与分和之前的群发时间相同。若未群发过，默认时间为2分钟后。</small></p>
					{{/if}}
				</div>
			</div>
		</div>
	</div>
	
	
	
	
	<div class="form-group">
		<label class="col-sm-2 control-label"></label>
		<div class="col-sm-9"><input class="btn btn-primary" type="submit" value="提交"></div>
	</div>
	<br/><br/><br/>
	<div class="ui-portlet-header">
	      <span class="title">消息预览</span>            
	</div>
	<div class="previewBroad">
	</div>
{{$this->Form->end()}}
<script>
function prew_msg(mid){
	$('.previewBroad').load('/wx_msgs/wechat_preview?media_id='+mid+' #wxmsg-preview',function(){
		
	});
}
{{if $this->data['WxTimingBroad']['media_id']}}
$(function(){
	prew_msg("{{$this->data['WxTimingBroad']['media_id']}}");
})
{{/if}}
</script>

